Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(devboard): Add support for Seeed Studio XIAO SAMD21 #27

Merged
merged 62 commits into from
Jul 24, 2023

Conversation

ZZ-Cat
Copy link
Owner

@ZZ-Cat ZZ-Cat commented Jul 16, 2023

Overview

This Pull Request adds initial support for Seeed Studio's XIAO SAMD21 development board.

Pinouts

CRSF for Arduino's UART port is SERCOM4:

  • Tx is A6/D6
  • Rx is A7/D7

Wiring

CRSF Receiver Seeed XIAO SAMD21
Rx D6
Tx D7
5V 5V
- GND

Testing

  1. Uncomment // #define CRSF_DEBUG in src\lib\CRSFforArduino\CRSFforArduino.h to enable message output to the Serial Monitor.
  2. Flash one of these examples onto your development board:
    • Arduino: channels.ino in the examples\channels directory.
    • PlatformIO: main_rc.cpp in the src\src directory.
  3. Open up the Serial Monitor.

Upon startup, you should see this message:
[CRSF for Arduino | INFO] Devboard Name: Seeed Studio Xiao SAMD21 in the display window.

If all is well, the initial startup will conclude with:

RC Channels Example
Ready

Followed by a short delay.

After that, you should be able to see your channel data in the Serial Monitor in the following format:
RC Channels <A: 1500, E: 1500, T: 1500, R: 1500, Aux1: 2000, Aux2: 1500, Aux3: 1500, Aux4: 1500>

If you are using ExpressLRS, Aux1 is your "Arming Channel" & 2000 represents "Armed" & 1000 represents "Disarmed". All other channel values are dependent on how you have configured your transmitter's packet settings in the ELRS Lua Script.

Errors

I have re-factored the way errors are handled during start-up. Every message is prefixed with [CRSF for Arduino | TYPE] followed by the error message. TYPE here refers to what type of message you are seeing. In the case of error messages, the prefix is [CRSF for Arduino | ERROR] with the appropriate error message.

The following table contains the errors you will encounter, if CRSF for Arduino is not initialising properly...

Error Message Triggered by or when... Error Source
Devboard is not compatible with CRSF for Arduino. Flashing CRSF for Arduino onto an incompatible development board. Compatibility Table
SERCOM instance not found. No valid UART port is found. CRSF for Arduino
DMA allocation failed with status: Status code 1 indicates no empty DMA channel was found. Adafruit ZeroDMA Library
DMA descriptor allocation failed. DMA Descriptor pointer is NULL. Adafruit ZeroDMA Library
DMA start failed with status: Status code 2 means the DMA tried to start on a channel that wasn't allocated. Status code 3 means that a bad transfer size was specified. Status code 6 means the resource is busy. Adafruit ZeroDMA Library

@ZZ-Cat ZZ-Cat self-assigned this Jul 16, 2023
@ZZ-Cat ZZ-Cat added ✨️ Enhancement ✨️ New feature or request 🚨 Help Wanted 🚨 "HELP! NOOOOWWW!!!" --The Heavy Weapons Guy, Team Fortress 2 labels Jul 16, 2023
@ZZ-Cat ZZ-Cat added this to the Version 0.4.0 milestone Jul 16, 2023
@ZZ-Cat ZZ-Cat changed the title feat(devboard): Initial support for Seeed XIAO feat(devboard): Initial support for Seeed XIAO SAMD21 Jul 17, 2023
@ZZ-Cat ZZ-Cat changed the title feat(devboard): Initial support for Seeed XIAO SAMD21 feat(devboard): Initial support for Seeed Studio XIAO SAMD21 Jul 17, 2023
@ZZ-Cat ZZ-Cat changed the title feat(devboard): Initial support for Seeed Studio XIAO SAMD21 feat(devboard): Add support for Seeed Studio XIAO SAMD21 Jul 17, 2023
ZZ-Cat added 6 commits July 17, 2023 12:52
…rd is incompatible.

This defers error handling of incompatible hardware to the programmer, instead of keeping it self-contained.
This will exit `CRSFforArduino::begin()` if a SERCOM instance was not found on the target devboard.
These will pop up in the Serial Monitor, if something fails to initialise in `CRSFforArduino::begin()`.
When `CRSFforArduino::begin()` fails, it is up to the programmer to decide how these errors are best handled.
Same as 5743a41. When `CRSFforArduino::begin()` fails, it is up to the programmer to decide how these errors are best handled.
@ZZ-Cat
Copy link
Owner Author

ZZ-Cat commented Jul 17, 2023

@grey1808, I have a favour to ask of you:
Can you check-out the Testing-SeeedXIAO-Support branch for me, test this Pull Request out on your Seeed Studio XIAO SAMD21 board, & report back your findings?

What I have done here is... hopefully (all fingers & toes crossed) this adds full support for your development board & it may resolve the issues you raised in #26 .

Also, at the start of writing this PR, I noticed that your XIAO was erroneously being seen as an Arduino Zero at compile time. Hence why you weren't seeing the errors that I was expecting. 🙃
That will be resolved, by the time I merge #28 into the Main-Trunk.

…le development boards (#28)

The Compatibility Table leverages the USB Vendor ID & Product ID to determine whether-or-not a development board is compatible with CRSF for Arduino.
@ZZ-Cat ZZ-Cat added the ⤴️ Rebase Needed ⤴️ This needs to be rebased. label Jul 19, 2023
ZZ-Cat added 7 commits July 19, 2023 13:56
This adds initial support for Seed Studio's XIAO development board.
…rd is incompatible.

This defers error handling of incompatible hardware to the programmer, instead of keeping it self-contained.
This will exit `CRSFforArduino::begin()` if a SERCOM instance was not found on the target devboard.
These will pop up in the Serial Monitor, if something fails to initialise in `CRSFforArduino::begin()`.
ZZ-Cat added 22 commits July 21, 2023 21:05
Stale issues & pull requests are closed after 30 days from being marked as stale
These are exempt from being automatically closed
This adds initial support for Seed Studio's XIAO development board.
…rd is incompatible.

This defers error handling of incompatible hardware to the programmer, instead of keeping it self-contained.
These will pop up in the Serial Monitor, if something fails to initialise in `CRSFforArduino::begin()`.
When `CRSFforArduino::begin()` fails, it is up to the programmer to decide how these errors are best handled.
Same as 5743a41. When `CRSFforArduino::begin()` fails, it is up to the programmer to decide how these errors are best handled.
This adds initial support for Seed Studio's XIAO development board.
@ZZ-Cat ZZ-Cat marked this pull request as ready for review July 22, 2023 01:28
@ZZ-Cat ZZ-Cat removed the ⤴️ Rebase Needed ⤴️ This needs to be rebased. label Jul 22, 2023
@ZZ-Cat
Copy link
Owner Author

ZZ-Cat commented Jul 22, 2023

Alright, I have made my decision.
I am merging this Pull Request first thing on Monday morning NZST & moving on from this.

Anyone that is still having issues with this development board, they are very welcome to submit a Bug Report from here on out.

@ZZ-Cat ZZ-Cat merged commit 98e34bd into Main-Trunk Jul 24, 2023
@ZZ-Cat ZZ-Cat deleted the Testing-SeeedXIAO-Support branch July 24, 2023 21:51
ZZ-Cat added a commit that referenced this pull request Jul 25, 2023
CRSF for Arduino is fully compatible with the Seeed Studio XIAO SAMD21 development board.

PlatformIO users can select this board in the `project.ini` file as `seeed_xiao`.
Arduino IDE users can select this board from the Boards Manager (provided support for this has been added to the Arduino IDE ahead of time).
ZZ-Cat added a commit that referenced this pull request Jul 25, 2023
CRSF for Arduino is fully compatible with the Seeed Studio XIAO SAMD21 development board.

PlatformIO users can select this board in the `project.ini` file as `seeed_xiao`.
Arduino IDE users can select this board from the Boards Manager (provided support for this has been added to the Arduino IDE ahead of time).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨️ Enhancement ✨️ New feature or request 🚨 Help Wanted 🚨 "HELP! NOOOOWWW!!!" --The Heavy Weapons Guy, Team Fortress 2
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant